import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { TagItem } from '@iux/live';

@Component({
  selector: 'app-checkable',
  templateUrl: './checkable.component.html',
  styles: [],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CheckableComponent implements OnInit {

  data: TagItem[];
  checkedData: TagItem[];

  constructor() {
  }

  ngOnInit() {
    this.initData();
  }

  initData() {
    this.data = this.initTag(5);
    this.checkedData = this.data.slice(0, 3);
  }

  initTag(length: number = 5) {
    return Array.from({ length }).map((item, key) => ({
      value: `${key}`,
      label: `Tag${key + 1}`,
      disabled: key === 1,
    }));
  }

  onCheckedChange(event) {
    console.log('checkedChange', event);
  }
}
